<?php
$config = array(
    'siteTitle' => 'Loja Virtual Lamarques',
    'siteUrl' => 'http://localhost/nanith/trunk/aplicacao/',
);
date_default_timezone_set('America/Sao_Paulo');

session_start();
ob_start();

function library($class) {
    set_include_path('core/classes/');
    spl_autoload_extensions('.class.php ');
    spl_autoload($class);
}

spl_autoload_register('library');

$Url = new Url();
$_parametros = $Url->getURLS();
$_modulo = $Url->getModulo();

if ($_modulo != 'basico') {
    $templateDir = array($_modulo . "/template", "template");
} else {
    $_modulo = 'welcome';
    $templateDir = array("welcome/template", "template");
}
$_controlador = $Url->getControlador();
$templatePadrao = $_controlador . ".tpl";
if (is_array($templateDir)) {
    foreach ($templateDir as $_dir) {
        if (!file_exists($_dir)) {
            mkdir($_dir, 0755, true);
        }
    }
} else {
    if (!file_exists($templateDir)) {
        mkdir($templateDir, 0755, true);
    }
}

$smarty = new Smarty();
$smarty->setTemplateDir($templateDir);
$smarty->setCompileDir('/tmp/');
$smarty->setCacheDir('/tmp/');
$smarty->assign('config', $config);
$smarty->setConfigDir('core/configs');
